package com.zy.assemble.fragment

import android.content.Intent
import com.zy.activity.BaseListFragment
import com.zy.activity.adapter.FragmentListBean
import com.zy.activity.adapter.ShowType
import com.zy.algorithm.v3.AlgorithmV3MainMenuActivity
import com.zy.list.DIYMainActivity
import java.util.ArrayList

class AlgorithmMainFragment : BaseListFragment() {
    override fun init(list: ArrayList<FragmentListBean>) {
        //list.add(FragmentListBean(ShowType.HEAD, "算法"))
        list.add(FragmentListBean(ShowType.COMMON, "排序算法", "排序算法", 1))
        list.add(FragmentListBean(ShowType.COMMON, "面试经典150", "面试经典150", 2))
    }

    override fun clickItem(bean: FragmentListBean) {
        when (bean.code) {
            1 -> {
                requireActivity().startActivity(
                    Intent(
                        requireContext(),
                        AlgorithmV3MainMenuActivity::class.java
                    )
                )
            }
            2 -> {
                requireActivity().startActivity(
                    Intent(
                        requireContext(),
                        DIYMainActivity::class.java
                    )
                )
            }
        }

    }

    companion object {
        fun newInstance() = AlgorithmMainFragment()
    }
}